package wator.model.topologies;

import wator.model.IntegerVector;
import wator.model.Topology;

/**
 * This topology does not connect universe boundaries at all. This is a
 * simple and fast implementation. {@link #apply(IntegerVector)} returns
 * <code>null</code> as soon as a vector is not in the allowed range.
 */
public class PlaneTopology extends Topology {

	/* (non-Javadoc)
	 * @see wator.model.Topology#apply(wator.model.IntegerVector)
	 */
	@Override
	public IntegerVector apply(IntegerVector v) {
		return v.min() < 0 || sizeVector.sub(v).min() < 0 ? null : v;
	}

	/* (non-Javadoc)
	 * @see wator.model.Topology#distanceVector(wator.model.IntegerVector, wator.model.IntegerVector)
	 */
	@Override
	public IntegerVector distanceVector(IntegerVector v1, IntegerVector v2) {
		return v2.sub(v1);
	}
}
